﻿<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page contentType="text/html; charset=utf-8" %>
<!DOCTYPE html>
<html  lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="../images/apple.ico" type="image/x-icon"/>
<title>后台管理</title>
<!--Main Stylesheet-->
<link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.min.css">  
<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="../js/xmlhttp.js"></script>
<link href="../css/admin.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<script type="text/javascript">

$(
function(){
var h=$(window).height();
$('#left').css("height",h);


$.ajax({
	type:'GET',
	url:'userlist.jsp',
	success:function(data){$('#uInfo').html(data)},
});

$.ajax({
	type:'GET',
	url:'msg_list.jsp',
	success:function(data){
		$('#uMsg').html(data);
	},
});

$.ajax({
	type:'GET',
	url:'mywork_msg.jsp',
	success:function(data){
		$('#myPublish').html(data);
	},
});

$('#mywork_publish_Button').click(
function(){

if($('#wname').val()==""||$('#category').val()==""||$('#hidden_pic').val()==""||$('#description').val()==""){
				alert("请将信息填写完整！");
			}else{
				if($('#description').val()=="请对手工作品的制作过程进行描述"){
				alert("请对您的手工作品进行描述！");
			}else{
				$.ajax({
	        type:'POST',
	        data:$('#myPbForm').serialize(),
	        url:'insertMyWork.jsp',
	        success:function(){
		 window.location.href=window.location.href;
                  	}
             });
			}
				
			} 

}
);

$('#description').focus(
function(){
var t=$(this).val();
if(t=="请对手工作品的制作过程进行描述"){
	$(this).val("");
}

$(this).css({"box-shadow":"0 0 2px 2px #fff","-moz-box-shadow":"0 0 2px 2px #fff","-webkit-box-shadow":"0 0 2px 2px #fff"});
}
);


$('#description').blur(
function(){
var t=$(this).val();
if(t==""){
	$(this).val("请对手工作品的制作过程进行描述");
}

$(this).css({"box-shadow":"0 0 0 0 #fff","-moz-box-shadow":"0 0 0 0 #fff","-webkit-box-shadow":"0 0 0 0 #fff"});
}
);
});


//左边栏隐藏
//$(window).resize(function(){
//	var wid=document.body.clientWidth;
//	if(wid<1000){

//		$('#left').css("display","none");
//	}else{
//		$('#left').css("display","block");
//	}
//});

function look(){
	$('#pic_url').click();
}

function setUrl(){
	var picUrl=$('#pic_url').val();
	$('#hidden_pic').val(picUrl);
}
</script>

<p style="color:black;">欢迎<%=session.getAttribute("AId") %>号管理员登陆后台管理系统！</p>
<span class="glyphicon glyphicon-log-out" style="position:absolute;top:10px;right:20px;margin:0;font-size:30px;" onclick="javascript:window.close();"title="退出后台"></span>

<!--left-->
<div class="col-md-6" style="margin-top:20px;margin-bottom:20px;">
<div class="col-md-12">

<!--用户信息模块-->
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
用户信息管理
</h3>
</div>
<div class="panel-body" id="uInfo" style="background-color: rgba(87, 87, 234, 0.37);">

</div>
</div>

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
用户发布的消息
</h3>
</div>
<div class="panel-body" id="uMsg"  style="background-color: rgba(87, 87, 234, 0.37);">

</div>
</div>

</div>
</div>


<!--right-->
<div class="col-md-6" style="margin-top:20px;margin-bottom:20px;">

<!--我的手工发布管理-->
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
我的发布管理
</h3>
</div>
<div class="panel-body" style="background-color: rgba(87, 87, 234, 0.37);">
<form role="form" id="myPbForm">
<div class="form-group" style="padding-top:20px;padding-bottom:20px;">
    <label for="wname" class="col-sm-2 control-label">手工名称</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" id="wname" name="wname" placeholder="请手工作品的名字"/>
    </div>
  </div>

  <div class="form-group"style="padding-top:20px;padding-bottom:20px;">
    <label for="category" class="col-sm-2 control-label">分类</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" id="category" name="category"  placeholder="请手工作品的类别"/>
    </div>
  </div>
 
  <div class="form-group"style="padding-top:20px;padding-bottom:20px;">
    <label for="u" class="col-sm-2 control-label">URL</label>
    <div class="col-sm-10">
	<input type="text" name="pic_url" id="hidden_pic"style="border:white 1px solid;"/><input type="button" value="浏览..." onclick="look()" style="border:white 1px solid;background-color:#E0E0FB;margin-left:10px;"/>
      <input type="file" id="pic_url" name="pic"style="display:none"onchange="setUrl()"/>
	  
    </div>
  </div>
  <textarea class="form-control"rows="10"overflow="scroll"style="margin-top:30px;"id="description" name="description">请对手工作品的制作过程进行描述</textarea>
<button class="btn btn-default" id="mywork_publish_Button" type="button">发布</button>
  </form>
</div>
</div>


<!--我发布的-->
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
我发布过的信息
</h3>
</div>
<div class="panal-body"id="myPublish"style="padding:20px;background-color: rgba(87, 87, 234, 0.37);"></div>
</div>
</div>
<div id="footer" style="background-color:black;width:100%;z-index:100;">
    <div class="col-md-4 col-md-offset-4"style="color:white;">Copyright &copy; Rita.&nbsp; All Rights Reserved.</div>
</div> 

</body>
</html>